package com.aha.dataanalyzeandview.config.datasource;

import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

/******************************
 * Project:           data-analyze-and-view
 * FileName:          MysqlDatasourceConfig.java
 * ClassName:         MysqlDatasourceConfig
 * Time:              2020/8/23 10:09
 * Version:           1.00
 * Author:            努力就是魅力
 * Description:       TODO
 ******************************/

public class MysqlQueryMetadataSqlConfig {


    public static String showDatabaseSql(){
        return "show database";
    }


    public static String showTablesSql(String dbName){
        return String.format("select table_name tableName, engine, table_comment tableComment, create_time createTime from information_schema.tables\n" +
                "\twhere table_schema =  %s ",dbName);
    }

    public static String queryAllColumnSql(String dbName, String tableName){
        return String.format("select column_name columnName, data_type dataType, column_comment columnComment from information_schema.columns\n" +
                " \twhere table_name = %s and table_schema = %s order by ordinal_position",tableName,dbName);
    }



}
